<?php

class Application_Model_UsersService
extends Application_Model_BaseService
{
    protected  $dbTableName = 'Application_Model_DbTable_Users';
    protected  $modelName = 'Application_Model_User';
	private    static $instance = null;
    
    public static function getInstance(){
        if (Application_Model_UsersService::$instance == null)
            Application_Model_UsersService::$instance = 
                new Application_Model_UsersService();
        
        return Application_Model_UsersService::$instance;
    }
    
    //-------------
    
    public function search_by_uni_session_code($uni_session_code)
    {
    	$table = $this->getDbTable();
		$rows = $table  ->fetchAll($table
                        ->select()
                        ->where('uni_session_code = ?', $uni_session_code));
                        
		if (count($rows)==1)
		{
			$rows = $rows[0];
			$res = $rows->toArray();
			$obj = $this->mapToObject($res);
	    	return $obj;
		}
		return null;
    }
}

